<html>
  <head>
    <style type="text/css">
      .well {
        background-color: white;
      }
    </style>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawVisualization);
      
      var st = <?php echo json_encode($status)?>;
      if(!st){
        document.write('<!--');
        alert("insufficient data !!");
      }

      function pie() {
        var data = google.visualization.arrayToDataTable([
          ['Day', 'Number of Followers'],
          ['Sat',  <?php echo $follow_daily[0];?>],
          ['Sun',  <?php echo $follow_daily[1];?>],
          ['Mon',  <?php echo $follow_daily[2];?>],
          ['Tue',  <?php echo $follow_daily[3];?>],
          ['Wed',  <?php echo $follow_daily[4];?>],
          ['Thurs',<?php echo $follow_daily[5];?>],
          ['Fri',  <?php echo $follow_daily[6];?>]
        ]);

        var options = {
          title: 'Followers/Day'
        };

        var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
      function line() {
        var data = google.visualization.arrayToDataTable([
          ['Hour', 'Tweets', 'Retweets', 'Favourites'],
          ['1',    <?php echo $tweets[0]['TweetsCount']['count']?>,     <?php echo $retweets[0]['RetweetsCount']['count']?>,         <?php echo $favs[0]['FavouritesCount']['count']?>],
          ['2',    <?php echo $tweets[1]['TweetsCount']['count']?>,     <?php echo $retweets[1]['RetweetsCount']['count']?>,         <?php echo $favs[1]['FavouritesCount']['count']?>],
          ['3', <?php echo $tweets[2]['TweetsCount']['count']?>,        <?php echo $retweets[2]['RetweetsCount']['count']?>,         <?php echo $favs[2]['FavouritesCount']['count']?>],
          ['4',  <?php echo $tweets[3]['TweetsCount']['count']?>,       <?php echo $retweets[3]['RetweetsCount']['count']?>,         <?php echo $favs[3]['FavouritesCount']['count']?>],
          ['5',  <?php echo $tweets[4]['TweetsCount']['count']?>,       <?php echo $retweets[4]['RetweetsCount']['count']?>,         <?php echo $favs[4]['FavouritesCount']['count']?>],
          ['6',  <?php echo $tweets[5]['TweetsCount']['count']?>,       <?php echo $retweets[5]['RetweetsCount']['count']?>,         <?php echo $favs[5]['FavouritesCount']['count']?>],
          ['7',  <?php echo $tweets[6]['TweetsCount']['count']?>,       <?php echo $retweets[6]['RetweetsCount']['count']?>,         <?php echo $favs[6]['FavouritesCount']['count']?>],
          ['8',  <?php echo $tweets[7]['TweetsCount']['count']?>,       <?php echo $retweets[7]['RetweetsCount']['count']?>,         <?php echo $favs[7]['FavouritesCount']['count']?>],
          ['9',  <?php echo $tweets[8]['TweetsCount']['count']?>,       <?php echo $retweets[8]['RetweetsCount']['count']?>,         <?php echo $favs[8]['FavouritesCount']['count']?>],
          ['10', <?php echo $tweets[9]['TweetsCount']['count']?>,      <?php echo $retweets[9]['RetweetsCount']['count']?>,         <?php echo $favs[9]['FavouritesCount']['count']?>],
          ['11',  <?php echo $tweets[10]['TweetsCount']['count']?>,      <?php echo $retweets[10]['RetweetsCount']['count']?>,        <?php echo $favs[10]['FavouritesCount']['count']?>],
          ['12',  <?php echo $tweets[11]['TweetsCount']['count']?>,      <?php echo $retweets[11]['RetweetsCount']['count']?>,        <?php echo $favs[11]['FavouritesCount']['count']?>],
          ['13',  <?php echo $tweets[12]['TweetsCount']['count']?>,      <?php echo $retweets[12]['RetweetsCount']['count']?>,        <?php echo $favs[12]['FavouritesCount']['count']?>],
          ['14',  <?php echo $tweets[13]['TweetsCount']['count']?>,      <?php echo $retweets[13]['RetweetsCount']['count']?>,        <?php echo $favs[13]['FavouritesCount']['count']?>],
          ['15',  <?php echo $tweets[14]['TweetsCount']['count']?>,      <?php echo $retweets[14]['RetweetsCount']['count']?>,        <?php echo $favs[14]['FavouritesCount']['count']?>],
          ['16',  <?php echo $tweets[15]['TweetsCount']['count']?>,      <?php echo $retweets[15]['RetweetsCount']['count']?>,        <?php echo $favs[15]['FavouritesCount']['count']?>],
          ['17',  <?php echo $tweets[16]['TweetsCount']['count']?>,      <?php echo $retweets[16]['RetweetsCount']['count']?>,        <?php echo $favs[16]['FavouritesCount']['count']?>],
          ['18',  <?php echo $tweets[17]['TweetsCount']['count']?>,      <?php echo $retweets[17]['RetweetsCount']['count']?>,        <?php echo $favs[17]['FavouritesCount']['count']?>],
          ['19',  <?php echo $tweets[18]['TweetsCount']['count']?>,      <?php echo $retweets[18]['RetweetsCount']['count']?>,        <?php echo $favs[18]['FavouritesCount']['count']?>],
          ['20',  <?php echo $tweets[19]['TweetsCount']['count']?>,      <?php echo $retweets[19]['RetweetsCount']['count']?>,        <?php echo $favs[19]['FavouritesCount']['count']?>],
          ['21',  <?php echo $tweets[20]['TweetsCount']['count']?>,      <?php echo $retweets[20]['RetweetsCount']['count']?>,        <?php echo $favs[20]['FavouritesCount']['count']?>],
          ['22',  <?php echo $tweets[21]['TweetsCount']['count']?>,      <?php echo $retweets[21]['RetweetsCount']['count']?>,        <?php echo $favs[21]['FavouritesCount']['count']?>],
          ['23',  <?php echo $tweets[22]['TweetsCount']['count']?>,      <?php echo $retweets[22]['RetweetsCount']['count']?>,        <?php echo $favs[22]['FavouritesCount']['count']?>],
          ['24',  <?php echo $tweets[23]['TweetsCount']['count']?>,      <?php echo $retweets[23]['RetweetsCount']['count']?>,        <?php echo $favs[23]['FavouritesCount']['count']?>]
        ]);

        var options = {
          title: 'Account Influence / Hour'
        };

        var chart = new google.visualization.LineChart(document.getElementById('chart_div2'));
        chart.draw(data, options);
      }

      function bar() {
        var data = google.visualization.arrayToDataTable([
          ['Hour', 'Tweets', 'Followers'],
          ['1',   <?php echo $tweets[0]['TweetsCount']['count']?>,       <?php echo $followers[0]['FollowersCount']['count']?>],
          ['2',   <?php echo $tweets[1]['TweetsCount']['count']?>,       <?php echo $followers[1]['FollowersCount']['count']?>,],
          ['3',   <?php echo $tweets[2]['TweetsCount']['count']?>,       <?php echo $followers[2]['FollowersCount']['count']?>],
          ['4',   <?php echo $tweets[3]['TweetsCount']['count']?>,       <?php echo $followers[3]['FollowersCount']['count']?>],
          ['5',   <?php echo $tweets[4]['TweetsCount']['count']?>,       <?php echo $followers[4]['FollowersCount']['count']?>],
          ['6',   <?php echo $tweets[5]['TweetsCount']['count']?>,       <?php echo $followers[5]['FollowersCount']['count']?>],
          ['7',   <?php echo $tweets[6]['TweetsCount']['count']?>,       <?php echo $followers[6]['FollowersCount']['count']?>],
          ['8',   <?php echo $tweets[7]['TweetsCount']['count']?>,       <?php echo $followers[7]['FollowersCount']['count']?>],
          ['9',   <?php echo $tweets[8]['TweetsCount']['count']?>,       <?php echo $followers[8]['FollowersCount']['count']?>],
          ['10',  <?php echo $tweets[9]['TweetsCount']['count']?>,       <?php echo $followers[9]['FollowersCount']['count']?>],
          ['11',  <?php echo $tweets[10]['TweetsCount']['count']?>,      <?php echo $followers[10]['FollowersCount']['count']?>],
          ['12',  <?php echo $tweets[11]['TweetsCount']['count']?>,      <?php echo $followers[11]['FollowersCount']['count']?>],
          ['13',  <?php echo $tweets[12]['TweetsCount']['count']?>,      <?php echo $followers[12]['FollowersCount']['count']?>],
          ['14',  <?php echo $tweets[13]['TweetsCount']['count']?>,      <?php echo $followers[13]['FollowersCount']['count']?>],
          ['15',  <?php echo $tweets[14]['TweetsCount']['count']?>,      <?php echo $followers[14]['FollowersCount']['count']?>],
          ['16',  <?php echo $tweets[15]['TweetsCount']['count']?>,      <?php echo $followers[15]['FollowersCount']['count']?>],
          ['17',  <?php echo $tweets[16]['TweetsCount']['count']?>,      <?php echo $followers[16]['FollowersCount']['count']?>],
          ['18',  <?php echo $tweets[17]['TweetsCount']['count']?>,      <?php echo $followers[17]['FollowersCount']['count']?>],
          ['19',  <?php echo $tweets[18]['TweetsCount']['count']?>,      <?php echo $followers[18]['FollowersCount']['count']?>],
          ['20',  <?php echo $tweets[19]['TweetsCount']['count']?>,      <?php echo $followers[19]['FollowersCount']['count']?>],
          ['21',  <?php echo $tweets[20]['TweetsCount']['count']?>,      <?php echo $followers[20]['FollowersCount']['count']?>],
          ['22',  <?php echo $tweets[21]['TweetsCount']['count']?>,      <?php echo $followers[21]['FollowersCount']['count']?>],
          ['23',  <?php echo $tweets[22]['TweetsCount']['count']?>,      <?php echo $followers[22]['FollowersCount']['count']?>],
          ['24',  <?php echo $tweets[23]['TweetsCount']['count']?>,      <?php echo $followers[23]['FollowersCount']['count']?>]
        ]);

        var options = {
          title: 'Increase in followers in relation to tweets',
        };

        var chart = new google.visualization.ColumnChart(document.getElementById('chart_div3'));
        chart.draw(data, options);
      }

      function drawVisualization() {
        pie();
        line();
        bar();
      }


    </script>
  </head>
  <body>
    <div class="row">
      <div class = "span2" id="chart_div" style="width: 500px; height: 500px;"></div>
      <div class = "span6" id="chart_div3" style="width: 625px; height: 500px;"></div>
    </div>
    <div id="chart_div2"></div>
</html>